<!-- @format -->

<template>
	<div class="flex flex_column" style="width: 100%;height: 700px;">
        <div class="flex" style="margin-bottom: 12px;width: 100%;">
            <div class="flex align_center" style="width:calc((100% - 40px) / 5);margin-right: 20px;">
                <div style="width:90px">结算收款方：</div>
                <div class="flex_1" style="overflow: hidden;">
                    <a-select style="" v-model="jiesuanID" :filter-option="filterOption" :options="jiesuanList" :field-names="{ label: 'name', value: 'id' }" allow-clear allow-search
                        placeholder="请选择客户名称" />
                </div>
                
            </div>
            <div class="flex align_center" style="width:calc((100% - 40px) / 5);margin-right: 20px;">
                <div style="width:100px">业务所属月份：</div>
                <a-month-picker
                    v-model="timeMon"
                    allow-clear
                    style=""
                />
            </div>
            <div class="flex align_center" style="flex:1">
                <div style="width:50px">备注：</div>
                <a-input style="flex:1" v-model="remark" placeholder="请输入备注" allow-clear />
            </div>
        </div>
        <div id="luckysheet" style="width:100%;height:100%;flex:1;"></div>
        <div class="flex justify_end" style="margin-top: 12px;">
            <a-button style="margin-right: 20px;">取消</a-button>
            <a-popconfirm @ok="handleJieSuan" content="是否结算数据?">
                <a-button type="primary">确认结算</a-button>
            </a-popconfirm>
            
        </div>
    </div>
</template>

<script setup>
	import { ref, reactive,defineProps,defineEmits,onMounted } from 'vue'
    import { request } from "@/utils/request.js";
    import { Message } from "@arco-design/web-vue";
    import { pinyin } from "pinyin-pro"
    import { createUniver, defaultTheme, LocaleType, Tools } from '@univerjs/presets';
    import { BooleanNumber, SheetTypes  } from "@univerjs/core";
    import { UniverSheetsCorePreset } from '@univerjs/presets/preset-sheets-core';
    import {
        UniverSheetsPlugin,
        RangeProtectionPermissionEditPoint,
        WorkbookEditablePermission,
    } from "@univerjs/sheets";
    import UniverPresetSheetsCoreEnUS from '@univerjs/presets/preset-sheets-core/locales/en-US';
    import UniverPresetSheetsCoreZhCN from '@univerjs/presets/preset-sheets-core/locales/zh-CN';
    import '@univerjs/presets/lib/styles/preset-sheets-core.css';

    const tableData = ref([])
    const emit = defineEmits(["shuaxin"]);
    const excelData = ref({
        name: "universheet",
        sheets: {
          "sheet": {
            type: SheetTypes.GRID,
            id: "sheet",
            cellData: {
              //数据
              0: {
                0: {
                  v: "运单号",
                },
                1:{
                    v:"客户名称"
                },
                2:{
                    v:"到达/发货时间"
                },
                3:{
                    v:"原票号"
                },
                4:{
                    v:"车号"
                },
                5:{
                    v:"运输方式"
                },
                6:{
                    v:"发站"
                },
                7:{
                    v:"到站"
                },
                8:{
                    v:"集装箱"
                },
                9:{
                    v:"品名"
                },
                10:{
                    v:"件数"
                },
                11:{
                    v:"货重"
                },
                12:{
                    v:"标重"
                },
                13:{
                    v:"承运人重量"
                },
                14:{
                    v:"计费重量"
                },
                15:{
                    v:"收入"
                },
                25:{
                    v:"清算"
                },
                35:{
                    v:"利润(含税)"
                },
                36:{
                    v:"利润(不含税)"
                },
                37:{
                    v:"合计结算金额"
                },
              },
              1:{
                15:{
                    v:"到站取送车费"
                },
                16:{
                    v:"货车延期占用费"
                },
                17:{
                    v:"集装箱延期使用费"
                },
                18:{
                    v:"印花税"
                },
                19:{
                    v:"发站取送车费"
                },
                20:{
                    v:"集装箱使用费"
                },
                21:{
                    v:"篷布使用费"
                },
                22:{
                    v:"运杂费迟交金"
                },
                23:{
                    v:"干线运输费"
                },
                24:{
                    v:"报价费"
                },
                25:{
                    v:"到站取送车费"
                },
                26:{
                    v:"货车延期占用费"
                },
                27:{
                    v:"集装箱延期使用费"
                },
                28:{
                    v:"印花税"
                },
                29:{
                    v:"发站取送车费"
                },
                30:{
                    v:"集装箱使用费"
                },
                31:{
                    v:"篷布使用费"
                },
                32:{
                    v:"运杂费迟交金"
                },
                33:{
                    v:"干线运输费"
                },
                34:{
                    v:"报价费"
                },

              },
            },
            name: "sheet", // 表名
            tabColor: "red",
            hidden: BooleanNumber.FALSE,
            rowCount: 6222, //表格行数
            columnCount: 38, //表格列数
            zoomRatio: 1,
            scrollTop: 200,
            scrollLeft: 100,
            defaultColumnWidth: 100, //单元格的宽度
            defaultRowHeight: 25, //单元格高度
            status: 1,
            showGridlines: 1,
            hideRow: [],
            hideColumn: [],
            rowHeader: {
              width: 30,
              hidden: BooleanNumber.FALSE,
            },
            columnHeader: {
              height: 20,
              hidden: BooleanNumber.FALSE,
            },
            selections: ["A2"],
            rightToLeft: BooleanNumber.FALSE,
            pluginMeta: {},
            mergeData: [
                { startRow: 0, endRow: 1, startColumn: 0, endColumn: 0 },
                { startRow: 0, endRow: 1, startColumn: 1, endColumn: 1 },
                { startRow: 0, endRow: 1, startColumn: 2, endColumn: 2 },
                { startRow: 0, endRow: 1, startColumn: 3, endColumn: 3 },
                { startRow: 0, endRow: 1, startColumn: 4, endColumn: 4 },
                { startRow: 0, endRow: 1, startColumn: 5, endColumn: 5 },
                { startRow: 0, endRow: 1, startColumn: 6, endColumn: 6 },
                { startRow: 0, endRow: 1, startColumn: 7, endColumn: 7 },
                { startRow: 0, endRow: 1, startColumn: 8, endColumn: 8 },
                { startRow: 0, endRow: 1, startColumn: 9, endColumn: 9 },
                { startRow: 0, endRow: 1, startColumn: 10, endColumn: 10 },
                { startRow: 0, endRow: 1, startColumn: 11, endColumn: 11 },
                { startRow: 0, endRow: 1, startColumn: 12, endColumn: 12 },
                { startRow: 0, endRow: 1, startColumn: 13, endColumn: 13 },
                { startRow: 0, endRow: 1, startColumn: 14, endColumn: 14 },

                
                { startRow: 0, endRow: 0, startColumn: 15, endColumn: 24 },
                { startRow: 1, endRow: 1, startColumn: 15, endColumn: 15 },
                { startRow: 1, endRow: 1, startColumn: 16, endColumn: 16 },
                { startRow: 1, endRow: 1, startColumn: 17, endColumn: 17 },
                { startRow: 1, endRow: 1, startColumn: 18, endColumn: 18 },
                { startRow: 1, endRow: 1, startColumn: 19, endColumn: 19 },
                { startRow: 1, endRow: 1, startColumn: 20, endColumn: 20 },
                { startRow: 1, endRow: 1, startColumn: 21, endColumn: 21 },
                { startRow: 1, endRow: 1, startColumn: 22, endColumn: 22 },
                { startRow: 1, endRow: 1, startColumn: 23, endColumn: 23 },
                { startRow: 1, endRow: 1, startColumn: 24, endColumn: 24 },



                { startRow: 0, endRow: 0, startColumn: 25, endColumn: 34 },
                { startRow: 1, endRow: 1, startColumn: 25, endColumn: 25 },
                { startRow: 1, endRow: 1, startColumn: 26, endColumn: 26 },
                { startRow: 1, endRow: 1, startColumn: 27, endColumn: 27 },
                { startRow: 1, endRow: 1, startColumn: 28, endColumn: 28 },
                { startRow: 1, endRow: 1, startColumn: 29, endColumn: 29 },
                { startRow: 1, endRow: 1, startColumn: 30, endColumn: 30 },
                { startRow: 1, endRow: 1, startColumn: 31, endColumn: 31 },
                { startRow: 1, endRow: 1, startColumn: 32, endColumn: 32 },
                { startRow: 1, endRow: 1, startColumn: 33, endColumn: 33 },
                { startRow: 1, endRow: 1, startColumn: 34, endColumn: 34 },
                
                { startRow: 0, endRow: 1, startColumn: 35, endColumn: 35 },
                { startRow: 0, endRow: 1, startColumn: 36, endColumn: 36 },
                { startRow: 0, endRow: 1, startColumn: 37, endColumn: 37 },
                
            ]
            // freeze:{
            //     startRow: -1,
            //     startColumn: 1,
            //     ySplit: 0,
            //     xSplit: 1,
            // }   
          },
        }
    })

    const props = defineProps({
        form:Object
    })
    const jiesuanList = ref([])
    const jiesuanID = ref('')
    const timeMon = ref('')
    const remark = ref('')
    const filterOption = (v,option)=>{
        return option.keywords.some(keywords=>keywords.includes(v))
    }
    onMounted(()=>{
        handleDeptList()
        handleDataList()
    })
    const handleJieSuan = ()=>{   // 结算
        if(jiesuanID.value == ''){
            return Message.error('请选择收款方')
        }
        if(timeMon.value == ''){
            return Message.error('请选择结算日期')
        }
        let excel = JSON.parse(JSON.stringify(excelData.value.sheets['sheet'].cellData))
        let table = JSON.parse(JSON.stringify(tableData.value))
        let tables = []
        table.map((v,i)=>{
            if(v.id == excel[i + 2][38].v){
                tables.push(v)
            }
           
        })
        tables.map((v,i)=>{
            v.detail.map((vv,ii)=>{
                if(vv.price_type == 6){
                    //收入
                    vv.pay_order_detail.pay_real_price = excel[i + 2][15].v
                    // 结算
                    vv.pay_real_price = excel[i + 2][25].v
                }
                if(vv.price_type == 20){
                    //收入
                    vv.pay_order_detail.pay_real_price = excel[i + 2][16].v
                    // 结算
                    vv.pay_real_price = excel[i + 2][26].v
                }
                if(vv.price_type == 17){
                    //收入
                    vv.pay_order_detail.pay_real_price = excel[i + 2][17].v
                    // 结算
                    vv.pay_real_price = excel[i + 2][27].v
                }
                if(vv.price_type == 13){
                    //收入
                    vv.pay_order_detail.pay_real_price = excel[i + 2][18].v
                    // 结算
                    vv.pay_real_price = excel[i + 2][28].v
                }
                if(vv.price_type == 7){
                    //收入
                    vv.pay_order_detail.pay_real_price = excel[i + 2][19].v
                    // 结算
                    vv.pay_real_price = excel[i + 2][29].v
                }
                if(vv.price_type == 16){
                    //收入
                    vv.pay_order_detail.pay_real_price = excel[i + 2][20].v
                    // 结算
                    vv.pay_real_price = excel[i + 2][33].v
                }
                if(vv.price_type == 5){
                    //收入
                    vv.pay_order_detail.pay_real_price = excel[i + 2][21].v
                    // 结算
                    vv.pay_real_price = excel[i + 2][31].v
                }
                if(vv.price_type == 22){
                    //收入
                    vv.pay_order_detail.pay_real_price = excel[i + 2][22].v
                    // 结算
                    vv.pay_real_price = excel[i + 2][32].v
                }
                if(vv.price_type == 1){
                    //收入
                    vv.pay_order_detail.pay_real_price = excel[i + 2][23].v
                    // 结算
                    vv.pay_real_price = excel[i + 2][33].v
                }
                if(vv.price_type == 14){
                    //收入
                    vv.pay_order_detail.pay_real_price = excel[i + 2][24].v
                    // 结算
                    vv.pay_real_price = excel[i + 2][34].v
                }
            })
        })
        // tables = JSON.stringify(tables)
        request({
            url: 'financial/settle/save',
            method: 'post',
            data: {
                dept_id:jiesuanID.value,
                jiesuanMon:timeMon.value,
                remark:remark.value,
                items:tables,
                type:props.form.detail_type
            }
        }).then(res => {
            console.log(res)
            if(res.code == 200){
                Message.success('结算成功')
                emit('shuaxin')
            }
            
        })
    }
    const handleDeptList = ()=>{
        request({
            url: 'system/dept/remote',
            method: 'post',
            data: {
            openPage: false,
            remoteOption: {
                filter: {
                type: ['=', 5],
                status: ['=',1]
                },
                select: ["id", "name"],
                sort: { id: "desc" }
            }
            }
        }).then(res => {
            res.data.map((v,i)=>{
                    v.keywords = [
                    v.name,
                    pinyin(v.name,{toneType:'none',pattern:'first'}).split(' ').join(''),
                    pinyin(v.name,{toneType:'none',pattern:'first'}).split(' ').join('').toUpperCase()
                    ]
            })
            
            jiesuanList.value = res.data
            console.log(jiesuanList.value)
        })
    }
    const handleExcel = (data)=>{
        const { univerAPI } = createUniver({
            locale: LocaleType.ZH_CN,
            locales: {
                enUS: UniverPresetSheetsCoreEnUS,
                zhCN: UniverPresetSheetsCoreZhCN,
            },
            theme: defaultTheme,
            presets: [
                UniverSheetsCorePreset({
                    container: 'luckysheet',
                    header:true,
                }),
            ],
        });
        
        excelData.value.sheets.sheet.cellData = {...excelData.value.sheets.sheet.cellData,...data}
        univerAPI.createUniverSheet(excelData.value);
    }
    const handleDataList = (obj)=>{   // 获取台账数据
        let objData = JSON.parse(JSON.stringify(props.form))
        objData.is_jiesuan = 0
        objData.pageSize = 10000
        request({
            url:'/financial/costOrder/index',
            method: 'get',
            params:objData,
        }).then(res=>{
            let _data = res.data.items
            _data.map((v,i)=>{
                if(!v.prediction){
                    v.prediction = v.send 
                }
                v.xuhao = i + 1
                v.total_price = v.pay_real_price - 0

                v.srdz_heji = 0
                v.srdz_buhansui = 0
                v.srdz_suie = 0
                v.qsdz_heji = 0
                v.qsdz_buhansui = 0
                v.qsdz_suie = 0

                v.srhc_heji = 0
                v.srhc_buhansui = 0
                v.srhc_suie = 0
                v.qshc_heji = 0
                v.qshc_buhansui = 0
                v.qshc_suie = 0

                v.srjzx_heji = 0
                v.srjzx_buhansui = 0
                v.srjzx_suie = 0
                v.qsjzx_heji = 0
                v.qsjzx_buhansui = 0
                v.qsjzx_suie = 0

                v.sryh_heji = 0
                v.sryh_buhansui = 0
                v.sryh_suie = 0
                v.qsyh_heji = 0
                v.qsyh_buhansui = 0
                v.qsyh_suie = 0

                v.srfz_heji = 0
                v.srfz_buhansui = 0
                v.srfz_suie = 0
                v.qsfz_heji = 0
                v.qsfz_buhansui = 0
                v.qsfz_suie = 0

                v.srjzxsy_heji = 0
                v.srjzxsy_buhansui = 0
                v.srjzxsy_suie = 0
                v.qsjzxsy_heji = 0
                v.qsjzxsy_buhansui = 0
                v.qsjzxsy_suie = 0

                v.srpb_heji = 0
                v.srpb_buhansui = 0
                v.srpb_suie = 0
                v.qspb_heji = 0
                v.qspb_buhansui = 0
                v.qspb_suie = 0

                v.sryzf_heji = 0
                v.sryzf_buhansui = 0
                v.sryzf_suie = 0
                v.qsyzf_heji = 0
                v.qsyzf_buhansui = 0
                v.qsyzf_suie = 0

                v.srgxf_heji = 0
                v.srgxf_buhansui = 0
                v.srgxf_suie = 0
                v.qsgxf_heji = 0
                v.qsgxf_buhansui = 0
                v.qsgxf_suie = 0

                v.srbjf_heji = 0
                v.srbjf_buhansui = 0
                v.srbjf_suie = 0
                v.qsbjf_heji = 0
                v.qsbjf_buhansui = 0
                v.qsbjf_suie = 0

                v.detail.map((vvv,iii)=>{
                    if(vvv.price_type == 6){
                        //  收入
                        v.srdz_heji = (vvv.pay_order_detail.pay_real_price - 0).toFixed(2) - 0
                        v.srdz_buhansui = (vvv.pay_order_detail.no_tax_price - 0).toFixed(2) - 0
                        v.srdz_suie = (vvv.pay_order_detail.tax_price - 0).toFixed(2) - 0
                        // 清算
                        v.qsdz_heji = (vvv.pay_real_price - 0).toFixed(2) - 0
                        v.qsdz_buhansui = (vvv.no_tax_price - 0).toFixed(2) - 0
                        v.qsdz_suie = (vvv.tax_price - 0).toFixed(2) - 0
                    }
                    if(vvv.price_type == 20){
                        // 收入
                        v.srhc_heji = (vvv.pay_order_detail.pay_real_price - 0).toFixed(2) - 0
                        v.srhc_buhansui = (vvv.pay_order_detail.no_tax_price - 0).toFixed(2) - 0
                        v.srhc_suie = (vvv.pay_order_detail.tax_price - 0).toFixed(2) - 0
                        // 清算
                        v.qshc_heji = (vvv.pay_real_price - 0).toFixed(2) - 0
                        v.qshc_buhansui = (vvv.no_tax_price - 0).toFixed(2) - 0
                        v.qshc_suie = (vvv.tax_price - 0).toFixed(2) - 0
                    }
                    if(vvv.price_type == 17){
                        // 收入
                        v.srjzx_heji = (vvv.pay_order_detail.pay_real_price - 0).toFixed(2) - 0
                        v.srjzx_buhansui = (vvv.pay_order_detail.no_tax_price - 0).toFixed(2) - 0
                        v.srjzx_suie = (vvv.pay_order_detail.tax_price - 0).toFixed(2) - 0
                        // 清算
                        v.qsjzx_heji = (vvv.pay_real_price - 0).toFixed(2) - 0
                        v.qsjzx_buhansui = (vvv.no_tax_price - 0).toFixed(2) - 0
                        v.qsjzx_suie = (vvv.tax_price - 0).toFixed(2) - 0
                    }
                    if(vvv.price_type == 13){
                        // 收入
                        v.sryh_heji = (vvv.pay_order_detail.pay_real_price - 0).toFixed(2) - 0
                        v.sryh_buhansui = (vvv.pay_order_detail.no_tax_price - 0).toFixed(2) - 0
                        v.sryh_suie = (vvv.pay_order_detail.tax_price - 0).toFixed(2) - 0
                        // 清算
                        v.qsyh_heji = (vvv.pay_real_price - 0).toFixed(2) - 0
                        v.qsyh_buhansui = (vvv.no_tax_price - 0).toFixed(2) - 0
                        v.qsyh_suie = (vvv.tax_price - 0).toFixed(2) - 0
                    }
                    if(vvv.price_type == 7){
                        //  收入
                        v.srfz_heji = (vvv.pay_order_detail.pay_real_price - 0).toFixed(2) - 0
                        v.srfz_buhansui = (vvv.pay_order_detail.no_tax_price - 0).toFixed(2) - 0
                        v.srfz_suie = (vvv.pay_order_detail.tax_price - 0).toFixed(2) - 0
                        // 清算
                        v.qsfz_heji = (vvv.pay_real_price - 0).toFixed(2) - 0
                        v.qsfz_buhansui = (vvv.no_tax_price - 0).toFixed(2) - 0
                        v.qsfz_suie = (vvv.tax_price - 0).toFixed(2) - 0
                    }
                    if(vvv.price_type == 16){
                        //  收入
                        v.srjzxsy_heji = (vvv.pay_order_detail.pay_real_price - 0).toFixed(2) - 0
                        v.srjzxsy_buhansui = (vvv.pay_order_detail.no_tax_price - 0).toFixed(2) - 0
                        v.srjzxsy_suie = (vvv.pay_order_detail.tax_price - 0).toFixed(2) - 0
                        // 清算
                        v.qsjzxsy_heji = (vvv.pay_real_price - 0).toFixed(2) - 0
                        v.qsjzxsy_buhansui = (vvv.no_tax_price - 0).toFixed(2) - 0
                        v.qsjzxsy_suie = (vvv.tax_price - 0).toFixed(2) - 0
                    }
                    if(vvv.price_type == 5){
                        //  收入
                        v.srpb_heji = (vvv.pay_order_detail.pay_real_price - 0).toFixed(2) - 0
                        v.srpb_buhansui = (vvv.pay_order_detail.no_tax_price - 0).toFixed(2) - 0
                        v.srpb_suie = (vvv.pay_order_detail.tax_price - 0).toFixed(2) - 0
                        // 清算
                        v.qspb_heji = (vvv.pay_real_price - 0).toFixed(2) - 0
                        v.qspb_buhansui = (vvv.no_tax_price - 0).toFixed(2) - 0
                        v.qspb_suie = (vvv.tax_price - 0).toFixed(2) - 0
                    }
                    if(vvv.price_type == 22){
                        //  收入
                        v.sryzf_heji = (vvv.pay_order_detail.pay_real_price - 0).toFixed(2) - 0
                        v.sryzf_buhansui = (vvv.pay_order_detail.no_tax_price - 0).toFixed(2) - 0
                        v.sryzf_suie = (vvv.pay_order_detail.tax_price - 0).toFixed(2) - 0
                        // 清算
                        v.qsyzf_heji = (vvv.pay_real_price - 0).toFixed(2) - 0
                        v.qsyzf_buhansui = (vvv.no_tax_price - 0).toFixed(2) - 0
                        v.qsyzf_suie = (vvv.tax_price - 0).toFixed(2) - 0
                    }
                    if(vvv.price_type == 1){
                        //  收入
                        v.srgxf_heji = (vvv.pay_order_detail.pay_real_price - 0).toFixed(2) - 0
                        v.srgxf_buhansui = (vvv.pay_order_detail.no_tax_price - 0).toFixed(2) - 0
                        v.srgxf_suie = (vvv.pay_order_detail.tax_price - 0).toFixed(2) - 0
                        // 清算
                        v.qsgxf_heji = (vvv.pay_real_price - 0).toFixed(2) - 0
                        v.qsgxf_buhansui = (vvv.no_tax_price - 0).toFixed(2) - 0
                        v.qsgxf_suie = (vvv.tax_price - 0).toFixed(2) - 0
                    }
                    if(vvv.price_type == 14){
                        //  收入
                        v.srbjf_heji = (vvv.pay_order_detail.pay_real_price - 0).toFixed(2) - 0
                        v.srbjf_buhansui = (vvv.pay_order_detail.no_tax_price - 0).toFixed(2) - 0
                        v.srbjf_suie = (vvv.pay_order_detail.tax_price - 0).toFixed(2) - 0
                        // 清算
                        v.qsbjf_heji = (vvv.pay_real_price - 0).toFixed(2) - 0
                        v.qsbjf_buhansui = (vvv.no_tax_price - 0).toFixed(2) - 0
                        v.qsbjf_suie = (vvv.tax_price - 0).toFixed(2) - 0
                    }
                })
                v.lirun_sui = (((v.srdz_heji - 0) + (v.srhc_heji - 0) + (v.srjzx_heji - 0) + (v.sryh_heji - 0) + (v.srfz_heji - 0) + (v.srjzxsy_heji - 0) + (v.srpb_heji - 0) + (v.sryzf_heji - 0) + (v.srgxf_heji - 0) + (v.srbjf_heji - 0)) - ((v.qsdz_heji - 0) + (v.qshc_heji - 0) + (v.qsjzx_heji - 0) + (v.qsyh_heji - 0) + (v.qsfz_heji - 0) + (v.qsjzxsy_heji - 0) + (v.qspb_heji - 0) + (v.qsyzf_heji - 0) + (v.qsgxf_heji - 0) + (v.qsbjf_heji - 0)))
                v.lirun = (((v.srdz_buhansui - 0) + (v.srhc_buhansui - 0) + (v.srjzx_buhansui - 0) + (v.sryh_buhansui - 0) + (v.srfz_buhansui - 0) + (v.srjzxsy_buhansui - 0) + (v.srpb_buhansui - 0) + (v.sryzf_buhansui - 0) + (v.srgxf_buhansui - 0) + (v.srbjf_buhansui - 0)) - ((v.qsdz_buhansui - 0) + (v.qshc_buhansui - 0) + (v.qsjzx_buhansui - 0) + (v.qsyh_buhansui - 0) + (v.qsfz_buhansui - 0) + (v.qsjzxsy_buhansui - 0) + (v.qspb_buhansui - 0) + (v.qsyzf_buhansui - 0) + (v.qsgxf_buhansui - 0) + (v.qsbjf_buhansui - 0)))
            })
            // columns.value.splice(columns.value.length - 3,0,...columnsArr)
            tableData.value = _data
            let excelItem = {

            }
            for (let i = 2;i<_data.length + 2;i++){
                excelItem[i] = {
                    0: {
                        v: _data[i - 2].prediction.yundanhao,
                    },
                    1:{
                        v:_data[i - 2].dept.name,
                    },
                    2:{
                        v:_data[i - 2].prediction.come_time,
                    },
                    3:{
                        v:_data[i - 2].prediction.ticket_number
                    },
                    4:{
                        v:_data[i - 2].prediction.car_no
                    },
                    5:{
                        v:_data[i - 2].prediction.transport_type == 1?'集装箱':_data[i - 2].prediction.transport_type == 2?'整车':'批量快运'
                    },
                    6:{
                        v:_data[i - 2].prediction.dzs?_data[i - 2].prediction.dzs.name:''
                    },
                    7:{
                        v:_data[i - 2].prediction.fzs?_data[i - 2].prediction.fzs.name:''
                    },
                    8:{
                        v:_data[i - 2].prediction.box
                    },
                    9:{
                        v:_data[i - 2].prediction.goods_name
                    },
                    10:{
                        v:_data[i - 2].prediction.number
                    },
                    11:{
                        v:_data[i - 2].prediction.hz_weight
                    },
                    12:{
                        v:_data[i - 2].prediction.bz_weight
                    },
                    13:{
                        v:_data[i - 2].prediction.cyr_weight
                    },
                    14:{
                        v:_data[i - 2].prediction.jf_weight
                    },
                    15:{
                        v:_data[i - 2].srdz_heji
                    },
                    16:{
                        v:_data[i - 2].srhc_heji
                    },
                    17:{
                        v:_data[i - 2].srjzx_heji
                    },
                    
                    18:{
                        v:_data[i - 2].sryh_heji
                    },
                    19:{
                        v:_data[i - 2].srfz_heji
                    },
                    20:{
                        v:_data[i - 2].srjzxsy_heji
                    },
                    21:{
                        v:_data[i - 2].srpb_heji
                    },
                    22:{
                        v:_data[i - 2].sryzf_heji
                    },
                    23:{
                        v:_data[i - 2].srgxf_heji
                    },
                    24:{
                        v:_data[i - 2].srbjf_heji
                    },

                    25:{
                        v:_data[i - 2].qsdz_heji
                    },
                    26:{
                        v:_data[i - 2].qshc_heji
                    },
                    27:{
                        v:_data[i - 2].qsjzx_heji
                    },
                    
                    28:{
                        v:_data[i - 2].qsyh_heji
                    },
                    29:{
                        v:_data[i - 2].qsfz_heji
                    },
                    30:{
                        v:_data[i - 2].qsjzxsy_heji
                    },
                    31:{
                        v:_data[i - 2].qspb_heji
                    },
                    32:{
                        v:_data[i - 2].qsyzf_heji
                    },
                    33:{
                        v:_data[i - 2].qsgxf_heji
                    },
                    34:{
                        v:_data[i - 2].qsbjf_heji
                    },
                    35:{
                        v:_data[i - 2].lirun_sui
                    },
                    36:{
                        v:_data[i - 2].lirun
                    },
                    37:{
                        v:_data[i - 2].total_price
                    },
                    38:{
                        v:_data[i - 2].id
                    },
                }
            }
            handleExcel(excelItem)
        })
    }
    
</script>

<style lang="less" scoped>
	.flex{
        display:flex;
    }
    .flex_wrap{
        flex-wrap:wrap
    }
    .justify_between{
        justify-content:space-between
    }
    .justify_around{
        justify-content:space-around
    }
    .justify_center{
        justify-content:center
    }
    
    .align_center{
        align-items:center;
    }
    .flex_1{
        flex:1
    }
    .width0{
        width:0
    }
    .ellipsis{
        overflow: hidden;
        text-overflow:ellipsis;
        white-space: nowrap;
    }
    .itemBox{
    content-visibility: auto;
    /* contain-intrinsic-size: 40px;  */
  }
    .item{
        height:40px;
        /* content-visibility: auto;
        contain-intrinsic-size: 40px;  */
    }

    .marbot16{
        margin-bottom:16px;
    }
</style>

